import Vue from 'vue';
import Router from 'vue-router';
// import header from '../components/header/header.vue';
// import footer from '../components/footer/footer.vue';
// import top from '../components/header/children/top.vue';
//我的做法是引入多个vue组件；我们需要分模块打包,把我们想要组合在一起的组件打包到一个 chunk块中去
// 分模块打包需要下面这样使用 webpack的 require.ensure,并且在最后加入一个 chunk名,
// 相同 chunk名字的模块将会打包到一起
// router/index.js 修改为懒加载组件
// Vue.use(Router);

const header = r => require.ensure([], () => r(require('../components/header/header.vue')), 'header')
const footer = r => require.ensure([], () => r(require('../components/footer/footer.vue')), 'footer')
const top = r => require.ensure([], () => r(require('../components/header/children/top.vue')), 'top')
const active = r => require.ensure([], () => r(require('../components/active/active.vue')), 'active')
const active_20111611 = r => require.ensure([], () => r(require('../components/active/20161111/20111611.vue')), 'active_20111611')
const active_20161122 = r => require.ensure([], () => r(require('../components/active/20161122/20161122.vue')), 'active_20161122')



const sign= r => require.ensure([], () => r(require('../components/sign/sign.vue')), 'sign')
const sign_head= r => require.ensure([], () => r(require('../components/sign/sign_head/sign_head.vue')), 'sign_head')
const city= r => require.ensure([], () => r(require('../components/sign/city/city.vue')), 'city')
const banner= r => require.ensure([], () => r(require('../components/sign/city/banner/banner.vue')), 'banner')
// const drivingschool= r => require.ensure([], () => r(require('../components/sign/city/drivingschool/drivingschool.vue')), 'drivingschool')
// 定义组件
// const Foo = { template:  header}
// const Bar = { template: '<div>bar</div>' }
// const TOP = { template: `<div>Foo {{ $route.params.id }}</div>`}
//定义路由
 export default [
	  {
	   path: '/header',
	    component: header,
	  	 children: [
	        {
	          path: 'top',
	          component: top
	        },
	      ]
	  },
	   {
	   path: '/xueting',
	   component: require('../components/xueting/xueting.vue'),
	  	 children: [
	        {
	          path: 'top',
	          component: top
	        },
	      ]
	  },
	  { 
      	path: '*', 
      	name:'error',
        component: require('../components/error.vue')
      },
      { 
      	path: '/footer', 
        component: footer 
      },
      {
	   path: '/active',//     // 当 /user/:id 匹配成功，
        // UserHome 会被渲染在 User 的 <router-view> 中
	   component: active,
	  	  children: [
	        {
	          path: '20161111',
	          component: active_20111611,
	        },
	        {
	          path: '20161122',
	          component: active_20161122,
	        },
	        { 
		      	path: '*', 
		      	name:'error',
		        component: require('../components/error.vue')
		    },
	      ]
	  },
	  {
	  	path: '/sign',
	  	component: sign,
	  	children: [
	  		{
	  			path: 'sign_head',
	  			component: sign_head
	  		},
	  		{
	  			path: 'sign_index',
	  			component:  require('../components/sign/sign_index/sign_index.vue')
	  		},
	  		{
	  			path: 'city',
	  			component: city,
	  			children:[
		  			{
		  				path: 'banner',
	  			        component: banner
		  			},
	  			]
	  		},
	  		{
	  			path: 'combodetail/:combo_id',
	  			component: require('../components/sign/combodetail/combodetail.vue')
	  		},
	  	]
	  }
]

